package cn.nexd.app.indoor.perimission;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.support.v4.content.ContextCompat;

/**
 * Created by wangxu on 16/4/7.
 */
public class CheckPermission {

    public static boolean checkPermission(Activity activity, String permission) {
        boolean isGranted = false;
        int checkResult = ContextCompat.checkSelfPermission(activity, permission);
        if (checkResult == PackageManager.PERMISSION_GRANTED) {
            isGranted = true;
        } else if (checkResult == PackageManager.PERMISSION_DENIED) {
            isGranted = false;
        }
        return isGranted;
    }
}
